-1 means that we have no specific preference for an initial
fullscreen monitor, and -1 is less than the number of monitors,
so we would end up accessing invalid memory. Prevent that.
https://bugzilla.gnome.org/show_bug.cgi?id=752875
const gchar *app_id;
GdkScreen *screen = gdk_window_get_screen (window);
struct wl_output *fullscreen_output = NULL;
- if (impl->initial_fullscreen_monitor < gdk_screen_get_n_monitors (screen))
+ if (impl->initial_fullscreen_monitor >= 0 &&
+ impl->initial_fullscreen_monitor < gdk_screen_get_n_monitors (screen))
fullscreen_output = _gdk_wayland_screen_get_wl_output (screen, impl->initial_fullscreen_monitor);
impl->xdg_surface = xdg_shell_get_xdg_surface (display_wayland->xdg_shell, impl->surface);